package com.class05.controller;

import com.class05.pojo.Person;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;




//正确的示例数据：
//{
//        "name": "张三",
//        "termsOfService": true,
//        "age": 25,
//        "weight": 68.0,
//        "email": "zhangsan@example.com",
//        "phoneNumber": "13800138000",
//        "birthDate": "1999-01-01",
//        "graduationDate": "2024-07-01",
//        "gender": "男"
//        }
@RestController
@RequestMapping("/pay")
public class PersonController {


    @PostMapping("/insertPerson")
//    需要加@Validated注解，否则无法校验数据的有效性
    public String insertPerson(@Validated @RequestBody  Person person){
        return person.toString();
    }
}
